use core::ops::Deref;

use stm32f1::stm32f103::{
    tim1, tim10, tim11, tim12, tim13, tim14, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9,
    TIM10 as T10, 
    TIM11 as T11, 
    TIM12 as T12, 
    TIM13 as T13, 
    TIM14 as T14, 
    TIM1 as T1, 
    TIM2 as T2, 
    TIM3 as T3, 
    TIM4 as T4, 
    TIM5 as T5, 
    TIM6 as T6, 
    TIM7 as T7,
    TIM8 as T8, 
    TIM9 as T9,
};

pub struct TIM1;
pub struct TIM2;
pub struct TIM3;
pub struct TIM4;
pub struct TIM5;
pub struct TIM6;
pub struct TIM7;
pub struct TIM8;
pub struct TIM9;
pub struct TIM10;
pub struct TIM11;
pub struct TIM12;
pub struct TIM13;
pub struct TIM14;

impl Deref for TIM1 {
    type Target = tim1::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T1::PTR }
    }
}
impl Deref for TIM2 {
    type Target = tim2::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T2::PTR }
    }
}
impl Deref for TIM3 {
    type Target = tim3::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T3::PTR }
    }
}
impl Deref for TIM4 {
    type Target = tim4::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T4::PTR }
    }
}
impl Deref for TIM5 {
    type Target = tim5::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T5::PTR }
    }
}
impl Deref for TIM6 {
    type Target = tim6::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T6::PTR }
    }
}
impl Deref for TIM7 {
    type Target = tim7::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T7::PTR }
    }
}
impl Deref for TIM8 {
    type Target = tim8::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T8::PTR }
    }
}
impl Deref for TIM9 {
    type Target = tim9::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T9::PTR }
    }
}
impl Deref for TIM10 {
    type Target = tim10::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T10::PTR }
    }
}
impl Deref for TIM11 {
    type Target = tim11::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T11::PTR }
    }
}
impl Deref for TIM12 {
    type Target = tim12::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T12::PTR }
    }
}
impl Deref for TIM13 {
    type Target = tim13::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T13::PTR }
    }
}
impl Deref for TIM14 {
    type Target = tim14::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*T14::PTR }
    }
}
